In computer related technologies, certain programming languages provide a feature such as late binding. Late binding is a mechanism in which, for example, a method being called upon an object is looked up by name at runtime. In programming languages with early binding, a compiler can statically verify that there are one or more methods with the appropriate method name and signature. However, with late binding, the compiler does not have enough information to even verify if the called method exists. For example, certain programming languages allow a method to have multiple implementations, one of which is selected based on a condition specified in the source code. However, the condition is evaluated only at runtime during execution of the source code. So, the compiler does not know which implementation a method call is referring to until the source code is executed.
Prior art techniques use a data structure such as hashtable to store a mapping of a method name to its implementation. The mapping is stored as a key-value pair of method name and a pointer to the method's implementation. During the execution of the program, when the method is called upon, the hashtable is looked up by the method name and a pointer to the method implementation is obtained.
Maintaining and using a hashtable, especially at runtime, consumes a significant amount of computing resources. As the number of methods (or other objects that are supported for late binding) in the source code increases, the hashtable size increases and therefore, has an adverse impact on runtime memory. Further, performing a look up in the hashtable for every method call consumes a significant amount of time causing an adverse impact on the execution speed of the program.